
///HORDE CHAMPIONS
#include "ScriptPCH.h"
#include "trial_of_the_crusader.h"

#define    SPELL_PVP_TRINKET                65547 

/********************************/
/* Gorgrim Shadowcleave - 34458 */
/* Death Knight                 */
/********************************/

#define    SPELL_CHAINS_OF_ICE                66020
#define    SPELL_DEATH_GRIG                66017
#define    SPELL_ICEBOUND_FORTITUDE        66023
#define    SPELL_STRANGULATE                66018
/*
#define    SPELL_DEATH_COIL_10N            66019 
#define    SPELL_DEATH_COIL_10H            67930 
#define    SPELL_DEATH_COIL_25N            67929
#define    SPELL_DEATH_COIL_25H            67931
#define    SPELL_FROST_STRIKE_10N            66047 
#define    SPELL_FROST_STRIKE_10H            67936 
#define    SPELL_FROST_STRIKE_25N            67935
#define    SPELL_FROST_STRIKE_25H            67937
#define    SPELL_ICY_TOUCH_10N                66021
#define    SPELL_ICY_TOUCH_10H                67939
#define    SPELL_ICY_TOUCH_25N                67938
#define    SPELL_ICY_TOUCH_25H                67940
*/
#define    SPELL_DEATH_COIL                RAID_MODE(66019,67929,67930,67931)
#define    SPELL_FROST_STRIKE                RAID_MODE(66047,67935,67936,67937)
#define    SPELL_ICY_TOUCH                    RAID_MODE(66021,67938,67939,67940)
class boss_gorgrim_shadowcleave : public CreatureScript
{
public:
    boss_gorgrim_shadowcleave() : CreatureScript("boss_gorgrim_shadowcleave") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_gorgrim_shadowcleaveAI(pCreature);
    }

    struct boss_gorgrim_shadowcleaveAI : public ScriptedAI
    {
        boss_gorgrim_shadowcleaveAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;
        bool IsHeroic;
        //uint32 m_uiPvPTrinket_Timer;
        uint32 m_uiChainsofIce_Timer;
        uint32 m_uiDeathGrip_Timer;
        uint32 m_uiIceboundFortitude_Timer;
        uint32 m_uiStrangulate_Timer;
        uint32 m_uiDeathCoil_Timer;
        uint32 m_uiFrostStrike_Timer;
        uint32 m_uiIcyTouch_Timer;

        void Reset()
        {
            me->SetRespawnDelay(1);
            //m_uiPvPTrinket_Timer = 12000;
            m_uiChainsofIce_Timer = 20000;
            m_uiDeathGrip_Timer = 5000;
            m_uiIceboundFortitude_Timer = 15000;
            m_uiDeathCoil_Timer = 10000;
            m_uiStrangulate_Timer = 30000;
            m_uiFrostStrike_Timer = 8000;
            m_uiIcyTouch_Timer = 25000;
        }

        void Aggro(Unit* pWho)
        {
            if (!m_pInstance)
                return;

            if (m_pInstance->GetBossState(DATA_FACTION_CHAMPIONS) == DONE)
                me->ForcedDespawn();
            else
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, IN_PROGRESS);
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
            
            /*if (m_uiPvPTrinket_Timer < uiDiff)
            {
                DoCast(me, SPELL_PVP_TRINKET);
                
                m_uiPvPTrinket_Timer = 120000;
            }
            else 
                m_uiPvPTrinket_Timer -= uiuiDiff;*/

            if (m_uiChainsofIce_Timer < uiDiff)
            {
                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                    DoCast(pTarget, SPELL_CHAINS_OF_ICE);
            
                m_uiChainsofIce_Timer = 45000;
                
            }else 
                m_uiChainsofIce_Timer -= uiDiff;

            if (m_uiDeathGrip_Timer < uiDiff)
            {
                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                    DoCast(pTarget, SPELL_DEATH_GRIG);
            
                m_uiDeathGrip_Timer = 45000;
            }else 
                m_uiDeathGrip_Timer -= uiDiff;

            if (m_uiIceboundFortitude_Timer < uiDiff)
            {
                DoCast(me, SPELL_ICEBOUND_FORTITUDE);
            
                m_uiIceboundFortitude_Timer = 60000;
            
            }else 
                m_uiIceboundFortitude_Timer -= uiDiff;

            if (m_uiStrangulate_Timer < uiDiff)
            {
                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                    DoCast(pTarget, SPELL_STRANGULATE);
            
                m_uiStrangulate_Timer = 120000;
                
            }else 
                m_uiStrangulate_Timer -= uiDiff;

            if (m_uiDeathCoil_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_DEATH_COIL);
            
                m_uiDeathCoil_Timer = 10000;
            
            }else 
                m_uiDeathCoil_Timer -= uiDiff;
        
            if (m_uiFrostStrike_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_FROST_STRIKE);
            
                m_uiFrostStrike_Timer = 10000;
            
            }else 
                m_uiFrostStrike_Timer -= uiDiff;

            if (m_uiIcyTouch_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_ICY_TOUCH);
                
                m_uiIcyTouch_Timer = 20000;
                
            }else 
                m_uiIcyTouch_Timer -= uiDiff;

            DoMeleeAttackIfReady();
        }

    };

};

/****************************/
/* Birana Stormhoof - 34451 */
/* Druid    Balance               */
/****************************/

#define    SPELL_BARKSKIN                    65860
#define    SPELL_CYCLONE                    65859
#define    SPELL_ENTANGLING_ROOTS            65857
#define    SPELL_FAERIE_FIRE                65863
#define    SPELL_FORCE_OF_NATURE            65861
/*
#define    SPELL_INSECT_SWARM_10N            65855
#define    SPELL_INSECT_SWARM_10H            67942
#define    SPELL_INSECT_SWARM_25N            67941 
#define    SPELL_INSECT_SWARM_25H            67943
#define    SPELL_MOONFIRE_10N                65856 
#define    SPELL_MOONFIRE_10H                67945
#define    SPELL_MOONFIRE_25N                67944 
#define    SPELL_MOONFIRE_25H                67946
#define    SPELL_STARFIRE_10N                65854 
#define    SPELL_STARFIRE_10H                67948
#define    SPELL_STARFIRE_25N                67947 
#define    SPELL_STARFIRE_25H                67949
#define    SPELL_WRATH_10N                    65862 
#define    SPELL_WRATH_10H                    67952
#define    SPELL_WRATH_25N                    67951 
#define    SPELL_WRATH_25H                     67953
*/
#define    SPELL_WRATH                        RAID_MODE(65862,67951,67952,67953)
#define    SPELL_STARFIRE                    RAID_MODE(65854,67947,67948,67949)
#define    SPELL_MOONFIRE                    RAID_MODE(65856,67944,67945,67946)
#define    SPELL_INSECT_SWARM                RAID_MODE(65855,67941,67942,67943)
class boss_birana_stormhoof : public CreatureScript
{
public:
    boss_birana_stormhoof() : CreatureScript("boss_birana_stormhoof") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_birana_stormhoofAI(pCreature);
    }

    struct boss_birana_stormhoofAI : public ScriptedAI
    {
        boss_birana_stormhoofAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;
        uint32 m_uiBarkskin_Timer;
        uint32 m_uiCyclone_Timer;
        uint32 m_uiEntanglingRoots_Timer;
        //uint32 m_uiPvPTrinket_Timer;
        uint32 m_uiFaerieFire_Timer;
        uint32 m_uiForceofNature_Timer;
        uint32 m_uiInsectSwarm_Timer;
        uint32 m_uiMoonfire_Timer;
        uint32 m_uiStarfire_Timer;
        uint32 m_uiWrath_Timer;

        void Reset()
        {
            me->SetRespawnDelay(1);
            m_uiBarkskin_Timer = 1000;
            m_uiCyclone_Timer = 25000;
            m_uiEntanglingRoots_Timer = 35000;
            //m_uiPvPTrinket_Timer = 12000;
            m_uiFaerieFire_Timer = 10000;
            m_uiForceofNature_Timer = 60000;
            m_uiInsectSwarm_Timer = 20000;
            m_uiMoonfire_Timer = 7000;
            m_uiStarfire_Timer = 15000;
            m_uiWrath_Timer = 28000;
        }

        void Aggro(Unit* pWho)
        {
            if (!m_pInstance)
                return;

            if (m_pInstance->GetBossState(DATA_FACTION_CHAMPIONS) == DONE)
                me->ForcedDespawn();
            else
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, IN_PROGRESS);
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            if (m_uiFaerieFire_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_FAERIE_FIRE);
            
                m_uiFaerieFire_Timer = 15000;
            
            }else 
                m_uiFaerieFire_Timer -= uiDiff;

            if (m_uiForceofNature_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_FORCE_OF_NATURE);
                
                m_uiForceofNature_Timer = 60000;
                
            }else
                m_uiForceofNature_Timer -= uiDiff;
        
            if (m_uiInsectSwarm_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_INSECT_SWARM);
                
                m_uiInsectSwarm_Timer = 25000;
                
            }else 
                m_uiInsectSwarm_Timer -= uiDiff;

            if (m_uiMoonfire_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_MOONFIRE);
                
                m_uiMoonfire_Timer = 7000;
                
            }else 
                m_uiMoonfire_Timer -= uiDiff;
        
            if (m_uiStarfire_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_STARFIRE);
                
                m_uiStarfire_Timer = 20000;
                
            }else 
                m_uiStarfire_Timer -= uiDiff;
        
            if (m_uiWrath_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_WRATH);
            
                m_uiWrath_Timer = 20000;
                
            }else 
                m_uiWrath_Timer -= uiDiff;
        
            if (m_uiCyclone_Timer < uiDiff)
            {
                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                    DoCast(pTarget, SPELL_CYCLONE);
                
                m_uiCyclone_Timer = 30000;
                
            }else 
                m_uiCyclone_Timer -= uiDiff;

            if (m_uiBarkskin_Timer < uiDiff)
            {
                DoCast(me, SPELL_BARKSKIN);
            
                m_uiBarkskin_Timer = 35000;
                
            }else 
                m_uiBarkskin_Timer -= uiDiff;
        
            if (m_uiEntanglingRoots_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_ENTANGLING_ROOTS);
                
                m_uiEntanglingRoots_Timer = 30000;
                
            }else 
                m_uiEntanglingRoots_Timer -= uiDiff;

            /*if (m_uiPvPTrinket_Timer < uiDiff)
            {
                DoCast(me, SPELL_PVP_TRINKET);
            
                m_uiPvPTrinket_Timer = 120000;
                
            }else 
                m_uiPvPTrinket_Timer -= uiDiff;*/
        
            DoMeleeAttackIfReady();
        }
    };

};

/*************************/
/* Erin Misthoof - 34459 */
/* Druid  Restoration               */
/*************************/

#define    SPELL_THORNS                    66068
#define SPELL_BARKSKIN                    65860
#define SPELL_NATURE_GRASP                66071
/*
#define    SPELL_NOURISH_10N                66066
#define    SPELL_NOURISH_10H                67966
#define    SPELL_NOURISH_25N                67965 
#define    SPELL_NOURISH_25H                67967
#define    SPELL_REGROWTH_10N                66067 
#define    SPELL_REGROWTH_10H                67969
#define    SPELL_REGROWTH_25N                67968
#define    SPELL_REGROWTH_25H                67970
#define    SPELL_REJUVENATION_10N            66065 
#define    SPELL_REJUVENATION_10H            67972
#define    SPELL_REJUVENATION_25N            67971 
#define    SPELL_REJUVENATION_25H            67973
#define    SPELL_TRANQUILITY_10N            66086
#define    SPELL_TRANQUILITY_10H            67975
#define    SPELL_TRANQUILITY_25N            67974 
#define    SPELL_TRANQUILITY_25H            67976
#define SPELL_LIFEBLOOM_10N                66093
#define SPELL_LIFEBLOOM_10H               67958
#define SPELL_LIFEBLOOM_25N               67957
#define SPELL_LIFEBLOOM_25H               67959
*/
#define    SPELL_NOURISH                    RAID_MODE(66066,67965,67966,67967)
#define    SPELL_REGROWTH                    RAID_MODE(66067,67968,67969,67970)
#define    SPELL_REJUVENATION                RAID_MODE(66065,67971,67972,67973)
#define    SPELL_TRANQUILITY                RAID_MODE(66086,67974,67975,67976)
#define SPELL_LIFEBLOOM                    RAID_MODE(66093,67957,67958,67959)
class boss_erin_misthoof : public CreatureScript
{
public:
    boss_erin_misthoof() : CreatureScript("boss_erin_misthoof") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_erin_misthoofAI(pCreature);
    }

    struct boss_erin_misthoofAI : public ScriptedAI
    {
        boss_erin_misthoofAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;
        //uint32 m_uiPvPTrinket_Timer;
        uint32 m_uiBarkskin_Timer;
        uint32 m_uiThorns_Timer;
        uint32 m_uiLifebloom_Timer;
        uint32 m_uiNourish_Timer;
        uint32 m_uiRegrowth_Timer;
        uint32 m_uiRejuvenation_Timer;
        uint32 m_uiTranquility_Timer;
        uint32 m_uiNatureGrasp_Timer;

        void Reset()
        {
            me->SetRespawnDelay(1);
            m_uiBarkskin_Timer = 1000;
            m_uiThorns_Timer = 3000;
            m_uiLifebloom_Timer = 5000;
            //m_uiPvPTrinket_Timer = 12000;
            m_uiNourish_Timer = 8000;
            m_uiRegrowth_Timer = 6000;
            m_uiRejuvenation_Timer = 45000;
            m_uiTranquility_Timer = 50000;
            m_uiNatureGrasp_Timer = urand(40000,80000);
        }

        void Aggro(Unit* pWho)
        {
            if (!m_pInstance)
                return;
            if (m_pInstance->GetBossState(DATA_FACTION_CHAMPIONS) == DONE)
                me->ForcedDespawn();
            else
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, IN_PROGRESS);
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
            
            if (m_uiBarkskin_Timer < uiDiff)
            {
                DoCast(me, SPELL_BARKSKIN);
            
                m_uiBarkskin_Timer = 35000;
            
            }else 
                m_uiBarkskin_Timer -= uiDiff;

            /*if (m_uiPvPTrinketTimer < uiDiff)
            {
                DoCast(me, SPELL_PVP_TRINKET);
            
                m_uiPvPTrinketTimer = 120000;
            
            }else 
                m_uiPvPTrinketTimer -= uiDiff;*/
        
            if (m_uiNatureGrasp_Timer < uiDiff)
            {
                DoCast(me, SPELL_NATURE_GRASP);
            
                m_uiNatureGrasp_Timer = urand(40000,80000);
            
            }else 
                m_uiNatureGrasp_Timer -= uiDiff;
        
            if (m_uiThorns_Timer < uiDiff)
            {       
                DoCast(me, SPELL_THORNS);
            
                m_uiThorns_Timer = 30000;
   
            }else 
                m_uiThorns_Timer -= uiDiff;

            if (m_uiLifebloom_Timer < uiDiff)
            {
                if(Unit* pTarget = DoSelectLowestHpFriendly(200, 1))
                    DoCast(pTarget, SPELL_LIFEBLOOM);
                
                m_uiLifebloom_Timer = 10000;
                
            }else 
                m_uiLifebloom_Timer -= uiDiff;

            if (m_uiNourish_Timer < uiDiff)
            {
                if(Unit* pTarget = DoSelectLowestHpFriendly(200, 1))
                    DoCast(pTarget, SPELL_NOURISH);
            
                m_uiNourish_Timer = 20000;
                
            }else 
                m_uiNourish_Timer -= uiDiff;

            if (m_uiRegrowth_Timer < uiDiff)
            {
                if(Unit* pTarget = DoSelectLowestHpFriendly(200, 1))
                    DoCast(pTarget, SPELL_REGROWTH);
            
                m_uiRegrowth_Timer = 15000;
                
            }else 
                m_uiRegrowth_Timer -= uiDiff;

            if (m_uiRejuvenation_Timer < uiDiff)
            {
                if(Unit* pTarget = DoSelectLowestHpFriendly(200, 1))
                    DoCast(pTarget, SPELL_REJUVENATION);
            
                m_uiRejuvenation_Timer = 45000;
            
            }else 
                m_uiRejuvenation_Timer -= uiDiff;

            if (m_uiTranquility_Timer < uiDiff)
            {
                if(Unit* pTarget = DoSelectLowestHpFriendly(200, 1))
                    DoCast(pTarget, SPELL_TRANQUILITY);
            
                m_uiTranquility_Timer = 600000;
                
            }else 
                m_uiTranquility_Timer -= uiDiff;

        
            DoMeleeAttackIfReady();
        }
    };

};

/************************/
/* Ruj'kah - 34448      */
/* Hunter               */
/************************/

#define    SPELL_DETERRENCE                65871
#define    SPELL_CALL_PET                    67777
#define    SPELL_FROST_TRAP                65880
#define    SPELL_WING_CLIP                    66207
#define    SPELL_DISENGAGE                    65869 
#define    SPELL_WYVERN_STING                65877 
#define    SPELL_STEADY_SHOT                65867
#define    SPELL_EXPLOSIVE_SHOT            RAID_MODE(65866,67983,67984,67985)
#define    SPELL_SHOOT                        RAID_MODE(65868,67988,67989,67990)
#define    SPELL_AIMED_SHOT                RAID_MODE(65883,67977,67978,67979)
class boss_rujkah : public CreatureScript
{
public:
    boss_rujkah() : CreatureScript("boss_rujkah") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_rujkahAI(pCreature);
    }

    struct boss_rujkahAI : public ScriptedAI
    {
        boss_rujkahAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;
        //uint32 m_uiPvPTrinket_Timer;
        uint32 m_uiDeterrence_Timer;
        uint32 m_uiCallPet_Timer;
        uint32 m_uiFrostTrap_Timer;
        uint32 m_uiExplosiveShot_Timer;
        uint32 m_uiAimedShot_Timer;
        uint32 m_uiWingClip_Timer;
        uint32 m_uiDisengage_Timer;
        uint32 m_uiShoot_Timer;
        uint32 m_uiWyvernSting_Timer;
        uint32 m_uiSteadyShot_Timer;
    
        void Reset()
        {
            m_uiDeterrence_Timer = 30000;
            m_uiCallPet_Timer = 1000;
            m_uiFrostTrap_Timer = 3000;
            //m_uiPvPTrinket_Timer = 12000;
            m_uiExplosiveShot_Timer = 10000;
            m_uiAimedShot_Timer = 8000;
            m_uiWingClip_Timer = 15000;
            m_uiDisengage_Timer = 30000;
            m_uiShoot_Timer = 5000;
            m_uiWyvernSting_Timer = 20000;
            m_uiSteadyShot_Timer = 7000;
        }

        void Aggro(Unit* pWho)
        {
            if (!m_pInstance)
                return;
 
            if (m_pInstance->GetBossState(DATA_FACTION_CHAMPIONS) == DONE)
                me->ForcedDespawn();
            else
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, IN_PROGRESS);
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            if (m_uiDeterrence_Timer < uiDiff)
            {
                DoCast(me, SPELL_DETERRENCE);
            
                m_uiDeterrence_Timer = 90000;
                
            }else 
                m_uiDeterrence_Timer -= uiDiff;

            if (m_uiCallPet_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_CALL_PET);
            
                m_uiCallPet_Timer = 600000;
                
            }else 
                m_uiCallPet_Timer -= uiDiff;

            if (m_uiFrostTrap_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_FROST_TRAP);
                
                m_uiFrostTrap_Timer = 30000;
                
            }else 
                m_uiFrostTrap_Timer -= uiDiff;

            /*if (m_uiPvPTrinket_Timer < uiDiff)
            {
                DoCast(me, SPELL_PvPTrinket);
            
                m_uiPvPTrinket_Timer = 120000;
            
            }else 
                m_uiPvPTrinket_Timer -= uiDiff;*/

            if (m_uiWingClip_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_WING_CLIP);
                
                m_uiWingClip_Timer = 12000;
                
            }else 
                m_uiWingClip_Timer -= uiDiff;

            if (m_uiDisengage_Timer < uiDiff)
            {
                DoCast(me, SPELL_DISENGAGE);
                
                m_uiDisengage_Timer = 30000;
                
            }else 
                m_uiDisengage_Timer -= uiDiff;

            if (m_uiWyvernSting_Timer < uiDiff)
            {
                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                    DoCast(pTarget, SPELL_WYVERN_STING);
                
                m_uiWyvernSting_Timer = 60000;
                
            }else 
                m_uiWyvernSting_Timer -= uiDiff;

            if (m_uiExplosiveShot_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_EXPLOSIVE_SHOT);
            
                m_uiExplosiveShot_Timer = 12000;
            
            }else 
                m_uiExplosiveShot_Timer -= uiDiff;

            if (m_uiAimedShot_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_AIMED_SHOT);
                
                m_uiAimedShot_Timer = 15000;
                
            }else 
                m_uiAimedShot_Timer -= uiDiff;

            if (m_uiShoot_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_SHOOT);
                
                m_uiShoot_Timer = 7000;
            
            }else 
                m_uiShoot_Timer -= uiDiff;
            
            if (m_uiSteadyShot_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_STEADY_SHOT);
                
                m_uiSteadyShot_Timer = 17000;
            
            }else 
                m_uiSteadyShot_Timer -= uiDiff;
        
            DoMeleeAttackIfReady();
        }
    };

};


/**********************************/
/* Ginselle Blightslinger - 34449 */
/* Mage                           */
/**********************************/
class boss_ginselle_blightslinger : public CreatureScript
{
public:
    boss_ginselle_blightslinger() : CreatureScript("boss_ginselle_blightslinger") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_ginselle_blightslingerAI(pCreature);
    }

    struct boss_ginselle_blightslingerAI : public ScriptedAI
    {
        boss_ginselle_blightslingerAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};

/******************************/
/* Liandra Suncaller - 34445  */
/* Paladin                    */
/******************************/
class boss_liandra_suncaller : public CreatureScript
{
public:
    boss_liandra_suncaller() : CreatureScript("boss_liandra_suncaller") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_liandra_suncallerAI(pCreature);
    }

    struct boss_liandra_suncallerAI : public ScriptedAI
    {
        boss_liandra_suncallerAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};

/********************************/
/* Malithas Brightblade - 34456 */
/* Paladin                      */
/********************************/

struct boss_malithas_brightbladeAI : public ScriptedAI
{
    boss_malithas_brightbladeAI(Creature* pCreature) : ScriptedAI(pCreature)
    {
        Reset();
        m_pInstance = pCreature->GetInstanceScript();
    }

    InstanceScript* m_pInstance;
    bool m_bIsRegularMode;

    void Reset()
    {
    }

    void Aggro(Unit* pWho)
    {
    }

    void JustDied(Unit* pKiller)
    {
        if(!m_pInstance)
            return;

        if(!me->FindNearestCreature(34458, 200, true)
        && !me->FindNearestCreature(34451, 200, true)
        && !me->FindNearestCreature(34459, 200, true)
        && !me->FindNearestCreature(34448, 200, true)
        && !me->FindNearestCreature(34449, 200, true)
        && !me->FindNearestCreature(34445, 200, true)
        && !me->FindNearestCreature(34456, 200, true)
        && !me->FindNearestCreature(34447, 200, true)
        && !me->FindNearestCreature(34441, 200, true)
        && !me->FindNearestCreature(34454, 200, true)
        && !me->FindNearestCreature(34455, 200, true)
        && !me->FindNearestCreature(34444, 200, true)
        && !me->FindNearestCreature(34450, 200, true)
        && !me->FindNearestCreature(34453, 200, true))
        {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
        }
    }

    void JustReachedHome()
    {
        m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
    }

    void KilledUnit(Unit* who)
    {
        if (who->GetTypeId() == TYPEID_PLAYER)
            m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
    }

    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;
        
        DoMeleeAttackIfReady();
    }
};

/*****************************/
/* Caiphus the Stern - 34447 */
/* Priest                    */
/*****************************/
class boss_caiphus_the_stern : public CreatureScript
{
public:
    boss_caiphus_the_stern() : CreatureScript("boss_caiphus_the_stern") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_caiphus_the_sternAI(pCreature);
    }

    struct boss_caiphus_the_sternAI : public ScriptedAI
    {
        boss_caiphus_the_sternAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};

/*********************************/
/* Vivienne Blackwhisper - 34441 */
/* Priest                        */
/*********************************/
class boss_vivienne_blackwhisper : public CreatureScript
{
public:
    boss_vivienne_blackwhisper() : CreatureScript("boss_vivienne_blackwhisper") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_vivienne_blackwhisperAI(pCreature);
    }

    struct boss_vivienne_blackwhisperAI : public ScriptedAI
    {
        boss_vivienne_blackwhisperAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};

/************************/
/* Maz'dinah - 34454    */
/* Rogue                */
/************************/

#define    SPELL_BLADE_FLURRY                65956
#define    SPELL_BLIND                        65960
#define    SPELL_CLOAK_OF_SHADOWS            65961
#define    SPELL_HEMORRHAGE                65954
#define    SPELL_EVISCERATE_10N            65957
#define    SPELL_EVISCERATE_10H            68095
#define    SPELL_EVISCERATE_25N            68094
#define    SPELL_EVISCERATE_25H            68096
#define    SPELL_FAN_OF_KNIVES_10N            65955
#define    SPELL_FAN_OF_KNIVES_10H            68098
#define    SPELL_FAN_OF_KNIVES_25N            68097 
#define    SPELL_FAN_OF_KNIVES_25H            68099
#define    SPELL_SHADOWSTEP                66178
class boss_mazdinah : public CreatureScript
{
public:
    boss_mazdinah() : CreatureScript("boss_mazdinah") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_mazdinahAI(pCreature);
    }

    struct boss_mazdinahAI : public ScriptedAI
    {
        boss_mazdinahAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;
        //uint32 PvPTrinket_Timer;
        uint32 m_uiBladeFlurry_Timer;
        uint32 m_uiBlind_Timer;
        uint32 m_uiCloakofShadows_Timer;
        uint32 m_uiHemorrhage_Timer;
        uint32 m_uiEviscerate_Timer;
        uint32 m_uiFanofKnives_Timer;
        uint32 m_uiShadowstep_Timer;

        void EnterEvadeMode()
        {
        }

        void Aggro(Unit* pWho)
        {
            if (!m_pInstance)
                return;
            
            if (m_pInstance->GetBossState(DATA_FACTION_CHAMPIONS) == DONE)
                me->ForcedDespawn();
            else
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, IN_PROGRESS);
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
            
            /*if (m_uiPvPTrinket_Timer < uiDiff)
            {
                DoCast(me, SPELL_PVP_TRINKET);
            
                m_uiPvPTrinket_Timer = 120000;
            
            }else 
                m_uiPvPTrinket_Timer -= uiDiff;*/

            if (m_uiBladeFlurry_Timer < uiDiff)
            {
                DoCast(me, SPELL_BLADE_FLURRY);
            
                m_uiBladeFlurry_Timer = 120000;
            
            }else 
                m_uiBladeFlurry_Timer -= uiDiff;

            if (m_uiBlind_Timer < uiDiff)
            {
                DoCast(me, SPELL_BLIND);
                
                m_uiBlind_Timer = 120000;
            
            }else 
                m_uiBlind_Timer -= uiDiff;

            if (m_uiCloakofShadows_Timer < uiDiff)
            {
                DoCast(me, SPELL_CLOAK_OF_SHADOWS);
            
                m_uiCloakofShadows_Timer = 90000;
            
            }else 
                m_uiCloakofShadows_Timer -= uiDiff;

            if (m_uiHemorrhage_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_HEMORRHAGE);
                
                m_uiHemorrhage_Timer = 30000;
            
            }else 
                m_uiHemorrhage_Timer -= uiDiff;

            if (m_uiEviscerate_Timer < uiDiff)
            {
                DoCast(me->getVictim(), RAID_MODE(SPELL_EVISCERATE_10N,SPELL_EVISCERATE_25N,SPELL_EVISCERATE_10H,SPELL_EVISCERATE_25H));
            
                m_uiEviscerate_Timer = 30000;
            
            }else 
                m_uiEviscerate_Timer -= uiDiff;

            if (m_uiFanofKnives_Timer < uiDiff)
            {
                DoCast(me->getVictim(), RAID_MODE(SPELL_FAN_OF_KNIVES_10N,SPELL_FAN_OF_KNIVES_25N,SPELL_FAN_OF_KNIVES_10H,SPELL_FAN_OF_KNIVES_25H));
                
                m_uiFanofKnives_Timer = 10000;
            
            }else 
                m_uiFanofKnives_Timer -= uiDiff;

            if (m_uiShadowstep_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_SHADOWSTEP);
            
                m_uiShadowstep_Timer = 30000;
            
            }else 
                m_uiShadowstep_Timer -= uiDiff;
        
            DoMeleeAttackIfReady();
        }
    };

};

/***************************/
/* Broln Stouthorn - 34455 */
/* Shaman                  */
/***************************/
class boss_broln_stouthorn : public CreatureScript
{
public:
    boss_broln_stouthorn() : CreatureScript("boss_broln_stouthorn") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_broln_stouthornAI(pCreature);
    }

    struct boss_broln_stouthornAI : public ScriptedAI
    {
        boss_broln_stouthornAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void EnterEvadeMode()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};

/************************/
/* Thrakgar - 34444     */
/* Shaman               */
/************************/
class boss_thrakgar : public CreatureScript
{
public:
    boss_thrakgar() : CreatureScript("boss_thrakgar") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_thrakgarAI(pCreature);
    }

    struct boss_thrakgarAI : public ScriptedAI
    {
        boss_thrakgarAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};

/*************************/
/* Harkzog - 34450       */
/* Warlock               */
/*************************/
class boss_harkzog : public CreatureScript
{
public:
    boss_harkzog() : CreatureScript("boss_harkzog") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_harkzogAI(pCreature);
    }

    struct boss_harkzogAI : public ScriptedAI
    {
        boss_harkzogAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};

/********************************/
/* Narrhok Steelbreaker - 34453 */
/* Warrior                      */
/********************************/
class boss_narrhok_steelbreaker : public CreatureScript
{
public:
    boss_narrhok_steelbreaker() : CreatureScript("boss_narrhok_steelbreaker") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_narrhok_steelbreakerAI(pCreature);
    }

    struct boss_narrhok_steelbreakerAI : public ScriptedAI
    {
        boss_narrhok_steelbreakerAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34458, 200, true)
            && !me->FindNearestCreature(34451, 200, true)
            && !me->FindNearestCreature(34459, 200, true)
            && !me->FindNearestCreature(34448, 200, true)
            && !me->FindNearestCreature(34449, 200, true)
            && !me->FindNearestCreature(34445, 200, true)
            && !me->FindNearestCreature(34456, 200, true)
            && !me->FindNearestCreature(34447, 200, true)
            && !me->FindNearestCreature(34441, 200, true)
            && !me->FindNearestCreature(34454, 200, true)
            && !me->FindNearestCreature(34455, 200, true)
            && !me->FindNearestCreature(34444, 200, true)
            && !me->FindNearestCreature(34450, 200, true)
            && !me->FindNearestCreature(34453, 200, true))
            {
                    m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};

///ALLIANCE CHAMPIONS

/********************************/
/* Tyrius Duskblade - 34461     */
/* Death Knight                 */
/********************************/

#define    SPELL_CHAINS_OF_ICE                66020
#define    SPELL_DEATH_GRIG                66017
#define    SPELL_ICEBOUND_FORTITUDE        66023
#define    SPELL_STRANGULATE                66018
#define    SPELL_DEATH_COIL                RAID_MODE(66019,67929,67930,67931)
#define    SPELL_FROST_STRIKE                RAID_MODE(66047,67935,67936,67937)
#define    SPELL_ICY_TOUCH                    RAID_MODE(66021,67938,67939,67940)
class boss_tyrius_duskblade : public CreatureScript
{
public:
    boss_tyrius_duskblade() : CreatureScript("boss_tyrius_duskblade") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_tyrius_duskbladeAI(pCreature);
    }

    struct boss_tyrius_duskbladeAI : public ScriptedAI
    {
        boss_tyrius_duskbladeAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;
        bool IsHeroic;
        //uint32 m_uiPvPTrinket_Timer;
        uint32 m_uiChainsofIce_Timer;
        uint32 m_uiDeathGrip_Timer;
        uint32 m_uiIceboundFortitude_Timer;
        uint32 m_uiStrangulate_Timer;
        uint32 m_uiDeathCoil_Timer;
        uint32 m_uiFrostStrike_Timer;
        uint32 m_uiIcyTouch_Timer;

        void Reset()
        {
            me->SetRespawnDelay(1);
            //m_uiPvPTrinket_Timer = 12000;
            m_uiChainsofIce_Timer = 20000;
            m_uiDeathGrip_Timer = 5000;
            m_uiIceboundFortitude_Timer = 15000;
            m_uiDeathCoil_Timer = 10000;
            m_uiStrangulate_Timer = 30000;
            m_uiFrostStrike_Timer = 8000;
            m_uiIcyTouch_Timer = 25000;
        }

        void Aggro(Unit* pWho)
        {
            if (!m_pInstance)
                return;

            if (m_pInstance->GetBossState(DATA_FACTION_CHAMPIONS) == DONE)
                me->ForcedDespawn();
            else
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, IN_PROGRESS);
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
            
            /*if (m_uiPvPTrinket_Timer < uiDiff)
            {
                DoCast(me, SPELL_PVP_TRINKET);
                
                m_uiPvPTrinket_Timer = 120000;
            }
            else 
                m_uiPvPTrinket_Timer -= uiuiDiff;*/

            if (m_uiChainsofIce_Timer < uiDiff)
            {
                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                    DoCast(pTarget, SPELL_CHAINS_OF_ICE);
            
                m_uiChainsofIce_Timer = 45000;
                
            }else 
                m_uiChainsofIce_Timer -= uiDiff;

            if (m_uiDeathGrip_Timer < uiDiff)
            {
                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                    DoCast(pTarget, SPELL_DEATH_GRIG);
            
                m_uiDeathGrip_Timer = 45000;
            }else 
                m_uiDeathGrip_Timer -= uiDiff;

            if (m_uiIceboundFortitude_Timer < uiDiff)
            {
                DoCast(me, SPELL_ICEBOUND_FORTITUDE);
            
                m_uiIceboundFortitude_Timer = 60000;
            
            }else 
                m_uiIceboundFortitude_Timer -= uiDiff;

            if (m_uiStrangulate_Timer < uiDiff)
            {
                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                    DoCast(pTarget, SPELL_STRANGULATE);
            
                m_uiStrangulate_Timer = 120000;
                
            }else 
                m_uiStrangulate_Timer -= uiDiff;

            if (m_uiDeathCoil_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_DEATH_COIL);
            
                m_uiDeathCoil_Timer = 10000;
            
            }else 
                m_uiDeathCoil_Timer -= uiDiff;
        
            if (m_uiFrostStrike_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_FROST_STRIKE);
            
                m_uiFrostStrike_Timer = 10000;
            
            }else 
                m_uiFrostStrike_Timer -= uiDiff;

            if (m_uiIcyTouch_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_ICY_TOUCH);
                
                m_uiIcyTouch_Timer = 20000;
                
            }else 
                m_uiIcyTouch_Timer -= uiDiff;

            DoMeleeAttackIfReady();
        }
    };

};

/********************************/
/* Kavina Grovesong - 34460     */
/* Druid Balance                */
/********************************/

#define    SPELL_BARKSKIN                    65860
#define    SPELL_CYCLONE                    65859
#define    SPELL_ENTANGLING_ROOTS            65857
#define    SPELL_FAERIE_FIRE                65863
#define    SPELL_FORCE_OF_NATURE            65861
#define    SPELL_WRATH                        RAID_MODE(65862,67951,67952,67953)
#define    SPELL_STARFIRE                    RAID_MODE(65854,67947,67948,67949)
#define    SPELL_MOONFIRE                    RAID_MODE(65856,67944,67945,67946)
#define    SPELL_INSECT_SWARM                RAID_MODE(65855,67941,67942,67943)
class boss_kavina_grovesong : public CreatureScript
{
public:
    boss_kavina_grovesong() : CreatureScript("boss_kavina_grovesong") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_kavina_grovesongAI(pCreature);
    }

    struct boss_kavina_grovesongAI : public ScriptedAI
    {
        boss_kavina_grovesongAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;
        uint32 m_uiBarkskin_Timer;
        uint32 m_uiCyclone_Timer;
        uint32 m_uiEntanglingRoots_Timer;
        //uint32 m_uiPvPTrinket_Timer;
        uint32 m_uiFaerieFire_Timer;
        uint32 m_uiForceofNature_Timer;
        uint32 m_uiInsectSwarm_Timer;
        uint32 m_uiMoonfire_Timer;
        uint32 m_uiStarfire_Timer;
        uint32 m_uiWrath_Timer;
    
        void Reset()
        {
            me->SetRespawnDelay(1);
            m_uiBarkskin_Timer = 1000;
            m_uiCyclone_Timer = 25000;
            m_uiEntanglingRoots_Timer = 35000;
            //m_uiPvPTrinket_Timer = 12000;
            m_uiFaerieFire_Timer = 10000;
            m_uiForceofNature_Timer = 60000;
            m_uiInsectSwarm_Timer = 20000;
            m_uiMoonfire_Timer = 7000;
            m_uiStarfire_Timer = 15000;
            m_uiWrath_Timer = 28000;
        }

        void Aggro(Unit* pWho)
        {
            if (!m_pInstance)
                return;

            if (m_pInstance->GetBossState(DATA_FACTION_CHAMPIONS) == DONE)
                me->ForcedDespawn();
            else
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, IN_PROGRESS);
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            if (m_uiFaerieFire_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_FAERIE_FIRE);
            
                m_uiFaerieFire_Timer = 15000;
            
            }else 
                m_uiFaerieFire_Timer -= uiDiff;

            if (m_uiForceofNature_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_FORCE_OF_NATURE);
                
                m_uiForceofNature_Timer = 60000;
                
            }else
                m_uiForceofNature_Timer -= uiDiff;
        
            if (m_uiInsectSwarm_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_INSECT_SWARM);
                
                m_uiInsectSwarm_Timer = 25000;
                
            }else 
                m_uiInsectSwarm_Timer -= uiDiff;

            if (m_uiMoonfire_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_MOONFIRE);
                
                m_uiMoonfire_Timer = 7000;
                
            }else 
                m_uiMoonfire_Timer -= uiDiff;
        
            if (m_uiStarfire_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_STARFIRE);
                
                m_uiStarfire_Timer = 20000;
                
            }else 
                m_uiStarfire_Timer -= uiDiff;
        
            if (m_uiWrath_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_WRATH);
            
                m_uiWrath_Timer = 20000;
                
            }else 
                m_uiWrath_Timer -= uiDiff;
        
            if (m_uiCyclone_Timer < uiDiff)
            {
                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                    DoCast(pTarget, SPELL_CYCLONE);
                
                m_uiCyclone_Timer = 30000;
                
            }else 
                m_uiCyclone_Timer -= uiDiff;

            if (m_uiBarkskin_Timer < uiDiff)
            {
                DoCast(me, SPELL_BARKSKIN);
            
                m_uiBarkskin_Timer = 35000;
                
            }else 
                m_uiBarkskin_Timer -= uiDiff;
        
            if (m_uiEntanglingRoots_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_ENTANGLING_ROOTS);
                
                m_uiEntanglingRoots_Timer = 30000;
                
            }else 
                m_uiEntanglingRoots_Timer -= uiDiff;

            /*if (m_uiPvPTrinket_Timer < uiDiff)
            {
                DoCast(me, SPELL_PVP_TRINKET);
            
                m_uiPvPTrinket_Timer = 120000;
                
            }else 
                m_uiPvPTrinket_Timer -= uiDiff;*/
        
            DoMeleeAttackIfReady();
        }
    };

};
/********************************/
/* Melador Valestrider - 34469  */
/* Druid  Restoration           */
/********************************/

#define    SPELL_THORNS                    66068
#define SPELL_BARKSKIN                    65860
#define SPELL_NATURE_GRASP                66071
/*
#define    SPELL_NOURISH_10N                66066
#define    SPELL_NOURISH_10H                67966
#define    SPELL_NOURISH_25N                67965 
#define    SPELL_NOURISH_25H                67967
#define    SPELL_REGROWTH_10N                66067 
#define    SPELL_REGROWTH_10H                67969
#define    SPELL_REGROWTH_25N                67968
#define    SPELL_REGROWTH_25H                67970
#define    SPELL_REJUVENATION_10N            66065 
#define    SPELL_REJUVENATION_10H            67972
#define    SPELL_REJUVENATION_25N            67971 
#define    SPELL_REJUVENATION_25H            67973
#define    SPELL_TRANQUILITY_10N            66086
#define    SPELL_TRANQUILITY_10H            67975
#define    SPELL_TRANQUILITY_25N            67974 
#define    SPELL_TRANQUILITY_25H            67976
#define SPELL_LIFEBLOOM_10N                66093
#define SPELL_LIFEBLOOM_10H               67958
#define SPELL_LIFEBLOOM_25N               67957
#define SPELL_LIFEBLOOM_25H               67959
*/
#define    SPELL_NOURISH                    RAID_MODE(66066,67965,67966,67967)
#define    SPELL_REGROWTH                    RAID_MODE(66067,67968,67969,67970)
#define    SPELL_REJUVENATION                RAID_MODE(66065,67971,67972,67973)
#define    SPELL_TRANQUILITY                RAID_MODE(66086,67974,67975,67976)
#define SPELL_LIFEBLOOM                    RAID_MODE(66093,67957,67958,67959)
class boss_melador_valestrider : public CreatureScript
{
public:
    boss_melador_valestrider() : CreatureScript("boss_melador_valestrider") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_melador_valestriderAI(pCreature);
    }

    struct boss_melador_valestriderAI : public ScriptedAI
    {
        boss_melador_valestriderAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;
        //uint32 m_uiPvPTrinket_Timer;
        uint32 m_uiBarkskin_Timer;
        uint32 m_uiThorns_Timer;
        uint32 m_uiLifebloom_Timer;
        uint32 m_uiNourish_Timer;
        uint32 m_uiRegrowth_Timer;
        uint32 m_uiRejuvenation_Timer;
        uint32 m_uiTranquility_Timer;
        uint32 m_uiNatureGrasp_Timer;
        
        void Reset()
        {
            me->SetRespawnDelay(1);
            m_uiBarkskin_Timer = 1000;
            m_uiThorns_Timer = 3000;
            m_uiLifebloom_Timer = 5000;
            //m_uiPvPTrinket_Timer = 12000;
            m_uiNourish_Timer = 8000;
            m_uiRegrowth_Timer = 6000;
            m_uiRejuvenation_Timer = 45000;
            m_uiTranquility_Timer = 50000;
            m_uiNatureGrasp_Timer = urand(40000,80000);
        }

        void Aggro(Unit* pWho)
        {
            if (!m_pInstance)
                return;
            if (m_pInstance->GetBossState(DATA_FACTION_CHAMPIONS) == DONE)
                me->ForcedDespawn();
            else
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, IN_PROGRESS);
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
            
            if (m_uiBarkskin_Timer < uiDiff)
            {
                DoCast(me, SPELL_BARKSKIN);
            
                m_uiBarkskin_Timer = 35000;
            
            }else 
                m_uiBarkskin_Timer -= uiDiff;

            /*if (m_uiPvPTrinketTimer < uiDiff)
            {
                DoCast(me, SPELL_PVP_TRINKET);
            
                m_uiPvPTrinketTimer = 120000;
            
            }else 
                m_uiPvPTrinketTimer -= uiDiff;*/
        
            if (m_uiNatureGrasp_Timer < uiDiff)
            {
                DoCast(me, SPELL_NATURE_GRASP);
            
                m_uiNatureGrasp_Timer = urand(40000,80000);
            
            }else 
                m_uiNatureGrasp_Timer -= uiDiff;
        
            if (m_uiThorns_Timer < uiDiff)
            {       
                DoCast(me, SPELL_THORNS);
            
                m_uiThorns_Timer = 30000;
   
            }else 
                m_uiThorns_Timer -= uiDiff;

            if (m_uiLifebloom_Timer < uiDiff)
            {
                if(Unit* pTarget = DoSelectLowestHpFriendly(200, 1))
                    DoCast(pTarget, SPELL_LIFEBLOOM);
                
                m_uiLifebloom_Timer = 10000;
                
            }else 
                m_uiLifebloom_Timer -= uiDiff;

            if (m_uiNourish_Timer < uiDiff)
            {
                if(Unit* pTarget = DoSelectLowestHpFriendly(200, 1))
                    DoCast(pTarget, SPELL_NOURISH);
            
                m_uiNourish_Timer = 20000;
                
            }else 
                m_uiNourish_Timer -= uiDiff;

            if (m_uiRegrowth_Timer < uiDiff)
            {
                if(Unit* pTarget = DoSelectLowestHpFriendly(200, 1))
                    DoCast(pTarget, SPELL_REGROWTH);
            
                m_uiRegrowth_Timer = 15000;
                
            }else 
                m_uiRegrowth_Timer -= uiDiff;

            if (m_uiRejuvenation_Timer < uiDiff)
            {
                if(Unit* pTarget = DoSelectLowestHpFriendly(200, 1))
                    DoCast(pTarget, SPELL_REJUVENATION);
            
                m_uiRejuvenation_Timer = 45000;
            
            }else 
                m_uiRejuvenation_Timer -= uiDiff;

            if (m_uiTranquility_Timer < uiDiff)
            {
                if(Unit* pTarget = DoSelectLowestHpFriendly(200, 1))
                    DoCast(pTarget, SPELL_TRANQUILITY);
            
                m_uiTranquility_Timer = 600000;
                
            }else 
                m_uiTranquility_Timer -= uiDiff;

        
            DoMeleeAttackIfReady();
        }
    };

};
/********************************/
/* Alyssia Moonstalker - 34467  */
/* Hunter                       */
/********************************/

#define    SPELL_DETERRENCE                65871
#define    SPELL_CALL_PET                    67777
#define    SPELL_FROST_TRAP                65880
#define    SPELL_WING_CLIP                    66207
#define    SPELL_DISENGAGE                    65869 
#define    SPELL_WYVERN_STING                65877 
#define    SPELL_STEADY_SHOT                65867
#define    SPELL_EXPLOSIVE_SHOT            RAID_MODE(65866,67983,67984,67985)
#define    SPELL_SHOOT                        RAID_MODE(65868,67988,67989,67990)
#define    SPELL_AIMED_SHOT                RAID_MODE(65883,67977,67978,67979)
class boss_alyssia_moonstalker : public CreatureScript
{
public:
    boss_alyssia_moonstalker() : CreatureScript("boss_alyssia_moonstalker") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_alyssia_moonstalkerAI(pCreature);
    }

    struct boss_alyssia_moonstalkerAI : public ScriptedAI
    {
        boss_alyssia_moonstalkerAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;
        //uint32 m_uiPvPTrinket_Timer;
        uint32 m_uiDeterrence_Timer;
        uint32 m_uiCallPet_Timer;
        uint32 m_uiFrostTrap_Timer;
        uint32 m_uiExplosiveShot_Timer;
        uint32 m_uiAimedShot_Timer;
        uint32 m_uiWingClip_Timer;
        uint32 m_uiDisengage_Timer;
        uint32 m_uiShoot_Timer;
        uint32 m_uiWyvernSting_Timer;
        uint32 m_uiSteadyShot_Timer;

        void Reset()
        {
            m_uiDeterrence_Timer = 30000;
            m_uiCallPet_Timer = 1000;
            m_uiFrostTrap_Timer = 3000;
            //m_uiPvPTrinket_Timer = 12000;
            m_uiExplosiveShot_Timer = 10000;
            m_uiAimedShot_Timer = 8000;
            m_uiWingClip_Timer = 15000;
            m_uiDisengage_Timer = 30000;
            m_uiShoot_Timer = 5000;
            m_uiWyvernSting_Timer = 20000;
            m_uiSteadyShot_Timer = 7000;
        }

        void Aggro(Unit* pWho)
        {
            if (!m_pInstance)
                return;
 
            if (m_pInstance->GetBossState(DATA_FACTION_CHAMPIONS) == DONE)
                me->ForcedDespawn();
            else
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, IN_PROGRESS);
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            if (m_uiDeterrence_Timer < uiDiff)
            {
                DoCast(me, SPELL_DETERRENCE);
            
                m_uiDeterrence_Timer = 90000;
                
            }else 
                m_uiDeterrence_Timer -= uiDiff;

            if (m_uiCallPet_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_CALL_PET);
            
                m_uiCallPet_Timer = 600000;
                
            }else 
                m_uiCallPet_Timer -= uiDiff;

            if (m_uiFrostTrap_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_FROST_TRAP);
                
                m_uiFrostTrap_Timer = 30000;
                
            }else 
                m_uiFrostTrap_Timer -= uiDiff;

            /*if (m_uiPvPTrinket_Timer < uiDiff)
            {
                DoCast(me, SPELL_PvPTrinket);
            
                m_uiPvPTrinket_Timer = 120000;
            
            }else 
                m_uiPvPTrinket_Timer -= uiDiff;*/

            if (m_uiWingClip_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_WING_CLIP);
                
                m_uiWingClip_Timer = 12000;
                
            }else 
                m_uiWingClip_Timer -= uiDiff;

            if (m_uiDisengage_Timer < uiDiff)
            {
                DoCast(me, SPELL_DISENGAGE);
                
                m_uiDisengage_Timer = 30000;
                
            }else 
                m_uiDisengage_Timer -= uiDiff;

            if (m_uiWyvernSting_Timer < uiDiff)
            {
                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                    DoCast(pTarget, SPELL_WYVERN_STING);
                
                m_uiWyvernSting_Timer = 60000;
                
            }else 
                m_uiWyvernSting_Timer -= uiDiff;

            if (m_uiExplosiveShot_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_EXPLOSIVE_SHOT);
            
                m_uiExplosiveShot_Timer = 12000;
            
            }else 
                m_uiExplosiveShot_Timer -= uiDiff;

            if (m_uiAimedShot_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_AIMED_SHOT);
                
                m_uiAimedShot_Timer = 15000;
                
            }else 
                m_uiAimedShot_Timer -= uiDiff;

            if (m_uiShoot_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_SHOOT);
                
                m_uiShoot_Timer = 7000;
            
            }else 
                m_uiShoot_Timer -= uiDiff;
            
            if (m_uiSteadyShot_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_STEADY_SHOT);
                
                m_uiSteadyShot_Timer = 17000;
            
            }else 
                m_uiSteadyShot_Timer -= uiDiff;
        
            DoMeleeAttackIfReady();
        }
    };

};

/********************************/
/* Hunter's Pet - 35610  */
/* Cat                        */
/********************************/

#define    SPELL_CLAW                    RAID_MODE(67793,67980,67981,67982)
class mob_cat : public CreatureScript
{
public:
    mob_cat() : CreatureScript("mob_cat") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new mob_catAI(pCreature);
    }

    struct mob_catAI : public ScriptedAI
    {
        mob_catAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;
        uint32 m_uiClaw_Timer;
    
        void Reset()
        {
            m_uiClaw_Timer = 5000;
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;
        }
    
        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
            
            if (m_uiClaw_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_CLAW);
                
                m_uiClaw_Timer = 5000;
            
            }else 
                m_uiClaw_Timer -= uiDiff;
        
            DoMeleeAttackIfReady();
        }
    
    };

};

/********************************/
/* Noozle Whizzlestick - 34468  */
/* Mage                         */
/********************************/
class boss_noozle_whizzlestick : public CreatureScript
{
public:
    boss_noozle_whizzlestick() : CreatureScript("boss_noozle_whizzlestick") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_noozle_whizzlestickAI(pCreature);
    }

    struct boss_noozle_whizzlestickAI : public ScriptedAI
    {
        boss_noozle_whizzlestickAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};
/********************************/
/* Velanaa - 34465              */
/* Paladin                      */
/********************************/
class boss_velanaa : public CreatureScript
{
public:
    boss_velanaa() : CreatureScript("boss_velanaa") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_velanaaAI(pCreature);
    }

    struct boss_velanaaAI : public ScriptedAI
    {
        boss_velanaaAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};
/********************************/
/* Baelnor Lightbearer - 34471  */
/* Paladin                      */
/********************************/
class boss_baelnor_lightbearer : public CreatureScript
{
public:
    boss_baelnor_lightbearer() : CreatureScript("boss_baelnor_lightbearer") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_baelnor_lightbearerAI(pCreature);
    }

    struct boss_baelnor_lightbearerAI : public ScriptedAI
    {
        boss_baelnor_lightbearerAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};
/********************************/
/* Anthar Forgemender - 34466   */
/* Priest                       */
/********************************/
class boss_anthar_forgemender : public CreatureScript
{
public:
    boss_anthar_forgemender() : CreatureScript("boss_anthar_forgemender") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_anthar_forgemenderAI(pCreature);
    }

    struct boss_anthar_forgemenderAI : public ScriptedAI
    {
        boss_anthar_forgemenderAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};
/********************************/
/* Brienna Nightfell - 34473    */
/* Priest                       */
/********************************/
class boss_brienna_nightfell : public CreatureScript
{
public:
    boss_brienna_nightfell() : CreatureScript("boss_brienna_nightfell") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_brienna_nightfellAI(pCreature);
    }

    struct boss_brienna_nightfellAI : public ScriptedAI
    {
        boss_brienna_nightfellAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};
/********************************/
/* Irieth Shadowstep - 34472    */
/* Rogue                        */
/********************************/

#define    SPELL_BLADE_FLURRY                65956
#define    SPELL_BLIND                        65960
#define    SPELL_CLOAK_OF_SHADOWS            65961
#define    SPELL_HEMORRHAGE                65954
/*
#define    SPELL_EVISCERATE_10N            65957
#define    SPELL_EVISCERATE_10H            68095
#define    SPELL_EVISCERATE_25N            68094
#define    SPELL_EVISCERATE_25H            68096
#define    SPELL_FAN_OF_KNIVES_10N            65955
#define    SPELL_FAN_OF_KNIVES_10H            68098
#define    SPELL_FAN_OF_KNIVES_25N            68097 
#define    SPELL_FAN_OF_KNIVES_25H            68099
*/
#define    SPELL_SHADOWSTEP                66178
#define    SPELL_FAN_OF_KNIVES                RAID_MODE(65955,68097,68098,68099)
#define    SPELL_EVISCERATE                RAID_MODE(65957,68094,68095,68096)
class boss_irieth_shadowstepe : public CreatureScript
{
public:
    boss_irieth_shadowstepe() : CreatureScript("boss_irieth_shadowstepe") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_irieth_shadowstepeAI(pCreature);
    }

    struct boss_irieth_shadowstepeAI : public ScriptedAI
    {
        boss_irieth_shadowstepeAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;
        //uint32 PvPTrinket_Timer;
        uint32 m_uiBladeFlurry_Timer;
        uint32 m_uiBlind_Timer;
        uint32 m_uiCloakofShadows_Timer;
        uint32 m_uiHemorrhage_Timer;
        uint32 m_uiEviscerate_Timer;
        uint32 m_uiFanofKnives_Timer;
        uint32 m_uiShadowstep_Timer;
    
        void Reset()
        {
            me->SetRespawnDelay(1);
            //PvPTrinket_Timer = 12000;
            m_uiBladeFlurry_Timer = 15000;
            m_uiBlind_Timer = 27000;
            m_uiCloakofShadows_Timer = 30000;
            m_uiHemorrhage_Timer = 20000;
            m_uiEviscerate_Timer = 25000;
            m_uiFanofKnives_Timer = 10000;
            m_uiShadowstep_Timer = 7000;
        }

    
        void Aggro(Unit* pWho)
        {
            if (!m_pInstance)
                return;
            
            if (m_pInstance->GetBossState(DATA_FACTION_CHAMPIONS) == DONE)
                me->ForcedDespawn();
            else
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, IN_PROGRESS);
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
            
            /*if (m_uiPvPTrinket_Timer < uiDiff)
            {
                DoCast(me, SPELL_PVP_TRINKET);
            
                m_uiPvPTrinket_Timer = 120000;
            
            }else 
                m_uiPvPTrinket_Timer -= uiDiff;*/

            if (m_uiBladeFlurry_Timer < uiDiff)
            {
                DoCast(me, SPELL_BLADE_FLURRY);
            
                m_uiBladeFlurry_Timer = 120000;
            
            }else 
                m_uiBladeFlurry_Timer -= uiDiff;

            if (m_uiBlind_Timer < uiDiff)
            {
                DoCast(me, SPELL_BLIND);
                
                m_uiBlind_Timer = 120000;
            
            }else 
                m_uiBlind_Timer -= uiDiff;

            if (m_uiCloakofShadows_Timer < uiDiff)
            {
                DoCast(me, SPELL_CLOAK_OF_SHADOWS);
            
                m_uiCloakofShadows_Timer = 90000;
            
            }else 
                m_uiCloakofShadows_Timer -= uiDiff;

            if (m_uiHemorrhage_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_HEMORRHAGE);
                
                m_uiHemorrhage_Timer = 30000;
            
            }else 
                m_uiHemorrhage_Timer -= uiDiff;

            if (m_uiEviscerate_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_EVISCERATE);
            
                m_uiEviscerate_Timer = 30000;
            
            }else 
                m_uiEviscerate_Timer -= uiDiff;

            if (m_uiFanofKnives_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_FAN_OF_KNIVES);
                
                m_uiFanofKnives_Timer = 10000;
            
            }else 
                m_uiFanofKnives_Timer -= uiDiff;

            if (m_uiShadowstep_Timer < uiDiff)
            {
                DoCast(me->getVictim(), SPELL_SHADOWSTEP);
            
                m_uiShadowstep_Timer = 30000;
            
            }else 
                m_uiShadowstep_Timer -= uiDiff;
        
            DoMeleeAttackIfReady();
        }
    };

};
/********************************/
/* Shaabad - 34463              */
/* Shaman                       */
/********************************/
class boss_shaabad : public CreatureScript
{
public:
    boss_shaabad() : CreatureScript("boss_shaabad") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_shaabadAI(pCreature);
    }

    struct boss_shaabadAI : public ScriptedAI
    {
        boss_shaabadAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};
/********************************/
/* Saamul - 34470               */
/* Shaman                       */
/********************************/
class boss_saamul : public CreatureScript
{
public:
    boss_saamul() : CreatureScript("boss_saamul") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_saamulAI(pCreature);
    }

    struct boss_saamulAI : public ScriptedAI
    {
        boss_saamulAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};
/********************************/
/* Serissa Grimdabbler - 34474  */
/* Warlock                      */
/********************************/
class boss_serissa_grimdabbler : public CreatureScript
{
public:
    boss_serissa_grimdabbler() : CreatureScript("boss_serissa_grimdabbler") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_serissa_grimdabblerAI(pCreature);
    }

    struct boss_serissa_grimdabblerAI : public ScriptedAI
    {
        boss_serissa_grimdabblerAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};
/********************************/
/* Shocuul - 34475              */
/* Warrior                      */
/********************************/
class boss_shocuul : public CreatureScript
{
public:
    boss_shocuul() : CreatureScript("boss_shocuul") { }

    CreatureAI* GetAI(Creature* pCreature) const
    {
        return new boss_shocuulAI(pCreature);
    }

    struct boss_shocuulAI : public ScriptedAI
    {
        boss_shocuulAI(Creature* pCreature) : ScriptedAI(pCreature)
        {
            Reset();
            m_pInstance = pCreature->GetInstanceScript();
        }

        InstanceScript* m_pInstance;
        bool m_bIsRegularMode;

        void Reset()
        {
        }

        void Aggro(Unit* pWho)
        {
        }

        void JustDied(Unit* pKiller)
        {
            if(!m_pInstance)
                return;

            if(!me->FindNearestCreature(34461, 200, true)
            && !me->FindNearestCreature(34460, 200, true)
            && !me->FindNearestCreature(34469, 200, true)
            && !me->FindNearestCreature(34467, 200, true)
            && !me->FindNearestCreature(34468, 200, true)
            && !me->FindNearestCreature(34465, 200, true)
            && !me->FindNearestCreature(34471, 200, true)
            && !me->FindNearestCreature(34466, 200, true)
            && !me->FindNearestCreature(34473, 200, true)
            && !me->FindNearestCreature(34472, 200, true)
            && !me->FindNearestCreature(34463, 200, true)
            && !me->FindNearestCreature(34470, 200, true)
            && !me->FindNearestCreature(34474, 200, true)
            && !me->FindNearestCreature(34475, 200, true))
            {
                m_pInstance->SetBossState(DATA_FACTION_CHAMPIONS, DONE);
            }
        }

        void JustReachedHome()
        {
            m_pInstance->SetData(RESET_TO_FIGHT, DATA_FACTION_CHAMPIONS);
        }

        void KilledUnit(Unit* who)
        {
            if (who->GetTypeId() == TYPEID_PLAYER)
                m_pInstance->SetData(UPDATE_DEATHS_COUNT, 0);
        }

        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;
        
            DoMeleeAttackIfReady();
        }
    };

};


void AddSC_boss_tc_champions()
{
    new boss_gorgrim_shadowcleave();
    new boss_birana_stormhoof();
    new boss_erin_misthoof();
    new boss_rujkah();
    new boss_ginselle_blightslinger();
    new boss_liandra_suncaller();
    new boss_caiphus_the_stern();
    new boss_vivienne_blackwhisper();
    new boss_mazdinah();
    new boss_broln_stouthorn();
    new boss_thrakgar();
    new boss_harkzog();
    new boss_narrhok_steelbreaker();
    new boss_tyrius_duskblade();
    new boss_kavina_grovesong();
    new boss_melador_valestrider();
    new boss_alyssia_moonstalker();
    new mob_cat();
    new boss_noozle_whizzlestick();
    new boss_velanaa();
    new boss_baelnor_lightbearer();
    new boss_anthar_forgemender();
    new boss_brienna_nightfell();
    new boss_irieth_shadowstepe();
    new boss_shaabad();
    new boss_saamul();
    new boss_serissa_grimdabbler();
    new boss_shocuul();
}
